主题
按键str - KeyPressStr
函数简介
根据指定的字符串序列,依次按顺序按下其中的字符。
接口名称
KeyPressStrDLL调用
int KeyPressStr(long ola, string key_str, int delay);参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| ola | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| key_str | 字符串 | 需要按下的字符串序列,如 "1234"、"abcd"、"7389,1462" 等。 |
| delay | 整数型 | 每按下一个按键的延时,单位毫秒(ms),值越大按的速度越慢。 |
示例
SDK 调用
cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
ola.KeyPressStr("hello");csharp
using OLAPlug;
var ola = new OLAPlugServer();
ola.KeyPressStr("hello");python
from OLAPlugServer import OLAPlugServer
ola = OLAPlugServer()
ola.KeyPressStr("hello")java
import com.olaplug.OLAPlugServer;
OLAPlugServer ola = new OLAPlugServer();
ola.KeyPressStr("hello");cpp
var ola = com("OlaPlug.OlaSoft")
ola.KeyPressStr("hello");vbscript
Set ola = CreateObject("OlaPlug.OlaSoft")
ola.KeyPressStr("hello");text
.局部变量 ola, OLAPlug
ola.创建 ()
ola.KeyPressStr("hello")aardio
import OLAPlugServer;
var ola = OLAPlugServer();
ola.KeyPressStr("hello");text
变量 ola <类型 = OLAPlugServer>
ola = 新建 OLAPlugServer
ola.KeyPressStr("hello");cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
ola.KeyPressStr("hello");原生 DLL 调用
cpp
long instance = CreateCOLAPlugInterFace();
KeyPressStr(instance, "hello");csharp
long instance = CreateCOLAPlugInterFace();
KeyPressStr(instance, "hello");python
from ctypes import CDLL, c_int, c_int64, create_string_buffer
ola = CDLL("OLAPlug_x64.dll")
ola.CreateCOLAPlugInterFace.restype = c_int64
instance = ola.CreateCOLAPlugInterFace()
KeyPressStr(instance, "hello")返回值
1 成功,0 失败。
注意事项
- 此接口只支持
a-z 0-9 ~-=[];',./和空格,其它字符一律不支持(包括中文)。 - 在 SendString 和 SendStringEx 都无法输入文字时,可以考虑使用此接口。
